package com.e1xp.deport_management_system.exception;

import lombok.Data;

/**
 * @Author E1xP@foxmail.com
 * @Version 1.0
 * @PACKAGE_NAME com.e1xp.deport_management_system.exception
 * @CLASS_NAME CustomException
 * @Description TODO 自定义异常类
 * @Date 2021/2/23 下午 1:19
 **/
@Data
public class CustomException extends Exception {

    public int code;

    public CustomException(String message, int code) {
        super(message);
        this.code = code;
    }

    public CustomException(CustomExceptionType exceptionTypeEnum, String message) {
        super(message);
        this.code = exceptionTypeEnum.getCode();
    }

    public CustomException(CustomExceptionType exceptionType) {
        super(exceptionType.getTypeDesc());
        this.code = exceptionType.getCode();
    }

}
